/* -------- 文件读取流 -------- */

let fs = require('fs');
let read = fs.createReadStream('./data/text1.txt');
read.setEncoding('UTF8')

let data = '';

read.on('data', function (content) {
	console.log('正在读取数据!');
	data += content;
})

read.on('end', function () {
	console.log('数据读取完成!');
	console.log('读取数据如下: ', data);
})

read.on('error', function () {
	console.log('出错信息: ', err.stack);
})

console.log('文件读取流.js执行完毕');